package children.health.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional;

import children.health.bean.UserInfo;

public interface ILoginDao extends Repository<UserInfo, Integer> {

	public UserInfo save(UserInfo info);

	public List<UserInfo> findByNameAndPass(String name, String pass);

	public List<UserInfo> findAll();

	@Transactional
	public int removeByName(String name);

	@Transactional
	@Modifying
	@Query("update UserInfo a set a.pass = ?2 where a.name = ?1")
	public int updatePass(String name, String newPass);
}
